#!/usr/bin/python3
# coding=utf-8
#
# Copyright (C) 2023-2024. Huawei Technologies Co., Ltd. All rights reserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# ===============================================================================

import numpy as np
import os

def tanh_shrink(x):
    return x - np.tanh(x)

def gen_golden_data_simple():
    # Generate random input data (range adjusted to cover typical activation region)
    input_data = np.random.uniform(low=-5.0, high=5.0, size=(8, 2048)).astype(np.float16)
    golden = tanh_shrink(input_data).astype(np.float16)
    
    # Save input and golden output
    os.makedirs("input", exist_ok=True)
    input_data.tofile("input/input_x.bin")
    
    os.makedirs("output", exist_ok=True)
    golden.tofile("output/golden.bin")

if __name__ == "__main__":
    gen_golden_data_simple()